Class TreeNode<T extends TreeNodeInfo>

java.lang.Object
edu.claflin.finder.algo.clustering.struct.TreeNode<T>
All Implemented Interfaces:
Comparable<TreeNode<T>>

public class TreeNode<T extends TreeNodeInfo> extends Object implements Comparable<TreeNode<T>>
The basic unit of the BinarySearchTree.
  • Field Details

  • Constructor Details

    • TreeNode

      public TreeNode()
    • TreeNode

      public TreeNode(T info)
      Create an empty TreeNode.
      Parameters:
      info - the information
    • TreeNode

      public TreeNode(T info, TreeNode<T> l, TreeNode<T> r)
  • Method Details

    • getInfo

      public T getInfo()
    • getLeftChild

      public TreeNode<T> getLeftChild()
      Get the left child TreeNode.
      Returns:
      the left child TreeNode
    • getRightChild

      public TreeNode<T> getRightChild()
      Get the right child TreeNode.
      Returns:
      the right child TreeNode
    • setNode

      public void setNode(T info, TreeNode<T> l, TreeNode<T> r)
      Set all the information of this TreeNode.
      Parameters:
      info - the information
      l - the left child TreeNode
      r - the right child TreeNode
    • setInfo

      public void setInfo(T info)
      Set the information of this TreeNode.
      Parameters:
      info - the info to set
    • setLeftChild

      public void setLeftChild(TreeNode<T> left)
      Set the left child TreeNode.
      Parameters:
      left - the left child TreeNode
    • setRightChild

      public void setRightChild(TreeNode<T> right)
      Set the right child TreeNode.
      Parameters:
      right - the right child TreeNode
    • duplicate

      public TreeNode<T> duplicate()
    • compareTo

      public int compareTo(TreeNode<T> that)
      Specified by:
      compareTo in interface Comparable<T extends TreeNodeInfo>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object